#!/bin/bash
# chkconfig: - 85 15
# description: Tomcat Server basic start/shutdown script
# processname: tomcat

JAVA_HOME=/usr/java/jdk1.7.0_71
export JAVA_HOME
 
TOMCAT_HOME=/usr/tomcat/apache-tomcat-7.0.57/bin
START_TOMCAT=/usr/tomcat/apache-tomcat-7.0.57/bin/startup.sh
STOP_TOMCAT=/usr/tomcat/apache-tomcat-7.0.57/bin/shutdown.sh
 
start() {
echo -n "Starting tomcat: "
cd $TOMCAT_HOME
${START_TOMCAT}
echo "done."
}
 
stop() {
echo -n "Shutting down tomcat: "
cd $TOMCAT_HOME
${STOP_TOMCAT}
echo "done."
}
 
case "$1" in
start)
start
;;
stop)
stop
;;
restart)
stop
sleep 10
start
;;
*)
echo "Usage: $0 {start|stop|restart}"
esac
exit 0